﻿/*
#**************************************************************************
#  openSIS is a student information system for public and non-public 
#  schools from Open Solutions for Education, Inc. web: www.os4ed.com
#
#  openSIS is  web-based, open source, and comes packed with features that 
#  include student demographic info, scheduling, grade book, attendance, 
#  report cards, eligibility, transcripts, parent portal, 
#  student portal and more.   
#
#  Visit the openSIS web site at http://www.opensis.com to learn more.
#  If you have question regarding this system or the license, please send 
#  an email to info@os4ed.com.
#
#  This program is released under the terms of the GNU General Public License  
#  as  published by the Free Software Foundation, version 2 of the License. 
#  See license.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#**************************************************************************** 

*/

function ToggleCheckboxes(spanChk,Mode) {

    
    var oItem = spanChk.children;

    var theBox = (spanChk.type == "checkbox") ? spanChk : spanChk.children.item[0];

    xState = theBox.checked;

    elm = theBox.form.elements;

    for (i = 0; i < elm.length; i++)

        if (elm[i].type == "checkbox" && elm[i].id != theBox.id) {

            //alert(elm[i].id)
            if (Mode == "Add") {

                if (elm[i].id == "ctl00_ContentPlaceHolder1_chkSun" || elm[i].id == "ctl00_ContentPlaceHolder1_chkMon" || elm[i].id == "ctl00_ContentPlaceHolder1_chkTue" || elm[i].id == "ctl00_ContentPlaceHolder1_chkWed" || elm[i].id == "ctl00_ContentPlaceHolder1_chkThurs" || elm[i].id == "ctl00_ContentPlaceHolder1_chkFri" || elm[i].id == "ctl00_ContentPlaceHolder1_chkSat") {
                    
                    if (elm[i].checked != xState)

                        elm[i].click();
                }
            }
            if (Mode == "Edit") {
                
                //***********
                if (elm[i].id == "ctl00_ContentPlaceHolder1_chkSunEdit" || elm[i].id == "ctl00_ContentPlaceHolder1_chkMonEdit" || elm[i].id == "ctl00_ContentPlaceHolder1_chkTueEdit" || elm[i].id == "ctl00_ContentPlaceHolder1_chkWedEdit" || elm[i].id == "ctl00_ContentPlaceHolder1_chkThuEdit" || elm[i].id == "ctl00_ContentPlaceHolder1_chkFriEdit" || elm[i].id == "ctl00_ContentPlaceHolder1_chkSatEdit") {
                   
                    if (elm[i].checked != xState)

                        elm[i].click();
                }
            }
    }

}
//***********27/07/09*************************

function TextBoxValue(textbox) {

    var time = document.getElementById(textbox).value;

    if (time != "") {

        if (document.getElementById(textbox).value.length <= 1) {
            document.getElementById(textbox).value = "0" + time;
        }
    }
    else {

        document.getElementById(textbox).value = "00";
    }

}

//********************28/07/09*******************

function isNumberKey(evt) {
    if (((event.keyCode > 47) && (event.keyCode < 58)) || (event.keyCode == 8) || (event.keyCode >= 96 && event.keyCode <= 105))
        return true;
    else
        return false;
}

function EnabledTextBox(checkbox, text1, text2, text3, text4, ddl1, ddl2) {
    
    if (document.getElementById(checkbox).checked == true) {
        
        document.getElementById(text1).disabled = false;
        document.getElementById(text2).disabled = false;
        document.getElementById(text3).disabled = false;
        document.getElementById(text4).disabled = false;
        document.getElementById(ddl1).disabled = false;
        document.getElementById(ddl2).disabled = false;
    }
    else {
        document.getElementById(text1).value = "";
        document.getElementById(text2).value = "";
        document.getElementById(text3).value = "";
        document.getElementById(text4).value = "";
        document.getElementById(ddl1).value = "AM";
        document.getElementById(ddl2).value = "AM";
        document.getElementById(text1).disabled = true;
        document.getElementById(text2).disabled = true;
        document.getElementById(text3).disabled = true;
        document.getElementById(text4).disabled = true;
        document.getElementById(ddl1).disabled = true;
        document.getElementById(ddl2).disabled = true;
    }

}